package com.rephilo.sqlSession;

import com.rephilo.pojo.Configuration;

import java.util.List;

public interface SqlSession {
    Configuration getConfiguration();

    /**
     * 查询所有
     *
     * @param statementId
     * @param params
     * @param <T>
     * @return
     */
    <T> List<T> selectList(String statementId, Object... params) throws Exception;

    /**
     * 根据查询条件查询单个
     *
     * @param statementId
     * @param params
     * @param <T>
     * @return
     */
    <T> T selectOne(String statementId, Object... params) throws Exception;

    /**
     * 插入数据
     *
     * @param statementId
     * @param params
     * @return
     * @throws Exception
     */
    Integer insert(String statementId, Object... params) throws Exception;

    /**
     * 更新数据
     *
     * @param statementId
     * @param params
     * @return
     * @throws Exception
     */
    Integer update(String statementId, Object... params) throws Exception;

    /**
     * 删除数据
     *
     * @param statementId
     * @param params
     * @return
     * @throws Exception
     */
    Integer delete(String statementId, Object... params) throws Exception;

    /**
     * 获取代理对象
     *
     * @param mapperClass
     * @param <T>
     * @return
     */
    <T> T getMapper(Class<?> mapperClass);
}
